{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('sharetrack', array('op' => 'display'));}">详细点击记录</a></li>
	<li {if $op == 'display_article_summary'}class="active"{/if}><a href="{php echo $this->createWebUrl('sharetrack', array('op' => 'display_article_summary'));}">按文章统计</a></li>
	<li {if $op == 'display_user_summary'}class="active"{/if}><a href="{php echo $this->createWebUrl('sharetrack', array('op' => 'display_user_summary'));}">按用户统计</a></li>
	<li {if $op == 'display_article_user_summary'}class="active"{/if}><a href="{php echo $this->createWebUrl('sharetrack', array('op' => 'display_article_user_summary'));}">按文章不同用户转发统计</a></li>
</ul>
<style>
.table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{white-space:inherit; overflow:inherit; text-overflow:inherit;}
.table td span{display:inline-block;margin-top:4px;}
.table td input{margin-bottom:0;}
.article_title {
	max-width:300px;
  min-width:200px;
}
.table>tbody>tr>.eclipse {
	white-space:nowrap;
  text-overflow:ellipsis;
	overflow: hidden;
  width:200px;
}
</style>

<form action="{php echo $this->createWebUrl('sharetrack', array('op'=>$op))}" method="post">
  <div class="panel panel-info">
    <div class="panel-heading">筛选</div>
    <div class="panel-body">

      <div class="form-group">
        <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">关键字</label>
        <div class="col-xs-12 col-sm-8 col-md-8 col-lg-8">
          <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}" placeholder="请输入文章关键词">
        </div>
        <div class="col-xs-12 col-sm-2 col-md-2 col-lg-2">
          <button class="btn btn-primary"><i class="fa fa-search fa fa-large"></i> 搜索</button>
        </div>
      </div>

    </div>
  </div>
</form>


{if $op == 'display'}
<div class="main">

    <div style="padding:15px;">
		<table class="table table-hover table-striped">
			<thead class="navbar-inner">
				<tr>
					<th style="width:200px" class="article_title">标题</th>
          <th style="width:200px">
            <span class="text-default">姓名</span>
            <span class="text-success">昵称</span>
            <span class="text-primary">手机</span>
          </th>
          <th style="width:270px"> <span class="text-default">分享者ID</span><br><span class="text-primary">点击者ID</span></th>
					<th style="width:120px">日期</th>
					<th style="width:50px">动作</th>
					<th style="width:120px"">IP</th>
					<th style="width:40px">点击次数</th>
					<th style="width:40px">奖励积分</th>
					<th style="width:40px; text-align:right;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
					<td class="eclipse">
            <a title="{$item['title']}" href="{php echo $this->createWebUrl('article', array('foo' => 'post', 'id' => $item['detail_id']))}" style="color:#333;">{$item['title']}</a>
					</td>
					<td>
            <span class="text-default">{$fans[$item['shareby']]['realname']}</span>
            <span class="text-success">{$fans[$item['shareby']]['nickname']}</span>
            <br/>
            <span class="text-primary">{$fans[$item['shareby']]['mobile']}</span>
					</td>
					<td>
            <span class='text-default' title="{$item['shareby']}">{$item['shareby']}</span><br/>
            <span class='text-primary' title="{$item['clicker_id']}">{if empty($item['clicker_id'])}************************{else}{$item['clicker_id']}{/if}</span>
					</td>
					<td>
            <span class="full"  data-original-title="{php echo date("Y-m-d H:i:s", $item['access_time'])}">{php echo date("m-d H:i:s", $item['access_time'])}</span>
					</td>
					<td>
						<span>{$item['track_type']}</span>
					</td>
					<td>
						<span>{$item['ip']}</span>
					</td>
					<td>
						<span>1</span>
					</td>
					<td>
						<span>{$item['credit']}</span>
					</td>
					<td style="text-align:right;">
						<a onclick="return confirm('此操作不可恢复，确认吗？'); return false;" href="{php echo $this->createWebUrl('sharetrack', array('do' => 'delete', 'id' => $item['id'], 'op' => 'delete'))}" title="删除" class="btn btn-sm"><i class="fa fa-remove"></i></a>
					</td>
				</tr>
				{/loop}
			</tbody>
			<!--tr>
				<td></td>
				<td colspan="3">
					<input name="token" type="hidden" value="{$_W['token']}" />
					<input type="submit" class="btn btn-primary" name="submit" value="提交" />
				</td>
			</tr-->
		</table>
    <span class='help-block'>用户填写礼品兑换申请表后，上面会自动显示姓名、昵称、手机等信息</span>
		{$pager}
	</div>
</div>
{/if}

{if $op == 'display_article_summary'}
<div class="main">
	<div style="padding:15px;">
		<table class="table table-hover table-striped">
			<thead class="navbar-inner">
				<tr>
					<th class="article_title">标题</th>
					<th style="">点击次数</th>
					<th style="">累计奖励积分</th>
					<th style="width:85px; text-align:right;">展开</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
					<td>
						<a href="{php echo $this->createWebUrl('article', array('foo' => 'post', 'id' => $item['detail_id']))}" style="color:#333;">{$item['title']}</a>
					</td>
					<td>
						<span>{$item['total_click']}</span>
					</td>
					<td>
						<span>{$item['total_credit']}</span>
					</td>
					<td style="text-align:right;">
						<a href="{php echo $this->createWebUrl('sharetrack', array('do' => 'sharetrack', 'keyword' => $item['title'], 'op' => 'display'))}" title="展开当前标题的所有记录" class="btn btn-sm"><i class="fa fa-list"></i></a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
{/if}
{if $op == 'display_article_user_summary'}
<div class="main">
	<div style="padding:15px;">
		<table class="table table-hover table-striped">
			<thead class="navbar-inner">
				<tr>
					<th class="article_title">标题</th>
          <th style="width:200px">
            <span class="text-default">姓名</span>
            <span class="text-success">昵称</span>
            <span class="text-primary">手机</span>
          </th>
          <th style="width:270px"> <span class="text-default">分享者ID</span></th>
					<th style="width:80px">点击次数</th>
					<th style="width:80px">支出积分</th>
					<th style="width:45px; text-align:right;">展开</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
					<td>
						<a href="{php echo $this->createWebUrl('article', array('foo' => 'post', 'id' => $item['detail_id']))}" style="color:#333;">{$item['title']}</a>
					</td>
					<td>
            <span class="text-default">{$fans[$item['shareby']]['realname']}</span>
            <span class="text-success">{$fans[$item['shareby']]['nickname']}</span>
            <br/>
            <span class="text-primary">{$fans[$item['shareby']]['mobile']}</span>
					</td>
					<td>
            <span class='text-default' title="{$item['shareby']}">{$item['shareby']}</span><br/>
					</td>
					<td>
						<span>{$item['total_click']}</span>
					</td>
					<td>
						<span>{$item['total_credit']}</span>
					</td>
					<td style="text-align:right;">
						<a href="{php echo $this->createWebUrl('sharetrack', array('do' => 'sharetrack', 'keyword' => $item['title'], 'op' => 'display'))}" title="展开当前标题的所有记录" class="btn btn-sm"><i class="fa fa-list"></i></a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
    <span class='help-block'>用户填写礼品兑换申请表后，上面会自动显示姓名、昵称、手机等信息</span>
		{$pager}
	</div>
</div>
{/if}
{if $op == 'display_user_summary'}
<div class="main">
	<div style="padding:15px;">
		<table class="table table-hover table-striped">
			<thead class="navbar-inner">
				<tr>
          <th style="width:200px">
            <span class="text-default">姓名</span>
            <span class="text-success">昵称</span>
            <span class="text-primary">手机</span>
          </th>
          <th style="width:270px"> <span class="text-default">分享者ID</span></th>
					<th style="">点击次数</th>
					<th style="">累计奖励积分</th>
					<th style="">用户系统积分</th>
					<th style="width:85px; text-align:right;">展开</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}

				<tr>
          <td>
            <span class="text-default">{$fans[$item['shareby']]['realname']}</span>
            <span class="text-success">{$fans[$item['shareby']]['nickname']}</span>
            <br/>
            <span class="text-primary">{$fans[$item['shareby']]['mobile']}</span>
          </td>
					<td>
            <span class='text-default' title="{$item['shareby']}">{$item['shareby']}</span><br/>
					</td>
					<td>
						<span>{$item['total_click']}</span>
					</td>
					<td>
						<span>{$item['total_credit']}</span>
					</td>
					<td>
						<span>{$fans[$item['shareby']]['credit1']}</span>
					</td>
					<td style="text-align:right;">
						<a href="{php echo $this->createWebUrl('sharetrack', array('do' => 'sharetrack', 'keyword' => $item['title'], 'shareby' => $item['shareby'], 'op' => 'display'))}" title="展开当前用户的所有记录" class="btn btn-sm"><i class="fa fa-list"></i></a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
    <span class='help-block'>用户填写礼品兑换申请表后，上面会自动显示姓名、昵称、手机等信息</span>
		{$pager}
	</div>
</div>
{/if}
<script>
  $('.btn').hover(function(){
    $(this).tooltip('show');
    },function(){
    $(this).tooltip('hide');
  });
  $('.full').hover(function(){
    $(this).tooltip('show');
    },function(){
    $(this).tooltip('hide');
  });
</script>
{template 'common/footer'}
